#ifndef ObjInt_First
#define ObjInt_First
#ifdef __GNUG__
#pragma interface
#endif

#include "Object.h"

//---- ObjInt ------------------------------------------------------------------

class ObjInt: public Object {
public:
	MetaDef(ObjInt);

	ObjInt();
	ObjInt(int v);

	int GetValue();
	int SetValue(int newval);
	int operator= (int newval);
	int operator++ ();
	int operator-- ();
	operator int();

	//---- comparing
	u_long Hash();
	bool IsEqual(Object*);
	int Compare(Object*);

	//---- converting
	const char *AsString();

	//---- activation passivation
	OStream &PrintOn(OStream&);
	IStream &ReadFrom(IStream&);

protected:
	int val;
};

inline ObjInt::ObjInt()
	{ val= 0; }
inline ObjInt::ObjInt(int v)
	{ val= v; }
inline int ObjInt::GetValue()
	{ return val; }
inline int ObjInt::SetValue(int newval)
	{ val= newval; Changed(); return val; }
inline int ObjInt::operator= (int newval)
	{ return SetValue(newval); }
inline int ObjInt::operator++ ()
	{ return SetValue(GetValue()+1); }
inline int ObjInt::operator-- ()
	{ return SetValue(GetValue()-1); }
inline ObjInt::operator int()
	{ return val; }

#endif

